use log::LevelFilter;
use simple_logger::SimpleLogger;
use tokio::fs;

use crate::error::{AppErr, ErrWrap};

pub const HTML_DIR: &'static str = "./data/html";
pub const WEB_ADDR: &'static str = "0.0.0.0:33334";
pub const DB_PATH: &'static str = "./data/data.db";

pub const ROOT_NAME: &'static str = "管理员";
pub const ROOT_ACCOUNT: &'static str = "root";
pub const ROOT_PWD: &'static str = "root1234";


pub async fn init() -> Result<(), AppErr> {
    SimpleLogger::new()
    .with_level(LevelFilter::Debug)
    .init().wrap()?;

    fs::create_dir_all(HTML_DIR).await?;
    Ok(())
}
